home *** CD-ROM | disk | FTP | other *** search
/ Precision Software Appli…tions Silver Collection 1 / Precision Software Applications Silver Collection Volume One (PSM) (1993).iso / windows / games / xlmath21.arj / SOURCE.ZIP / XLMINIT.C < prev    next >
C/C++ Source or Header  |  1993-04-10  |  3KB  |  115 lines

  1. /*----------------------------------------------------------------------*\
  2. \*----------------------------------------------------------------------*/
  3.  
  4. /*----------------------------------------------------------------------*\
  5.  
  6.  XLMINIT.C
  7.  
  8.  Author:    Roy Kari
  9.              Dept. of Chemistry
  10.             Laurentian University
  11.             Sudbury, Ont.
  12.             Canada        P3E 2C6
  13.             (705) 675-1151
  14.             Internet: "ROY@NICKEL.LAURENTIAN.CA"
  15.  
  16.     This modeule contains the library initialization functions 
  17.     & basic Excel API functions
  18. \*----------------------------------------------------------------------*/
  19.  
  20.  
  21. // --------------------------< Include files >--------------------- //
  22.  
  23. #define ININIT
  24. #define WIN31
  25. #define _MSC_VER 700
  26.  
  27. #include <windows.h>
  28. #include <xlcall.h>
  29.  
  30. #include <ctype.h>
  31.  
  32. #include <framewrk.h>
  33. #include "xlmath.h"
  34. #include <xlutil.h>
  35.  
  36.  
  37. // -------------------<Windows Entry & Exit Routines>-------------- //
  38.  
  39. /*********************************************************************
  40.  LibMain()
  41.  =========
  42.  This is the standard windows DLL entry routine. This allocates
  43.  a task descriptor in the local heap and does byte counts
  44.  ********************************************************************/
  45. BOOL PASCAL FAR _export LibMain(HANDLE hInstance, WORD wDataSegment,
  46.     WORD wHeapSize, LPSTR CommandLine)
  47. {
  48.  
  49.     if (wHeapSize > 0)
  50.         UnlockData(0);
  51.  
  52.     // init xlError which is returned for all errors
  53.     gxlError.xltype = xltypeErr;
  54.     gxlError.val.err = xlerrNA;
  55.  
  56.     // init the error routine help text
  57.     gxHelpRef.xltype = xltypeStr;
  58.     gxHelpRef.val.str = (LPSTR)gspHelpId;
  59.  
  60.     // init global references
  61.     // all I/O with the sheet is done throught these references
  62.     // each reference can only accomodate one range and hence
  63.     // multiple ranges on a worksheet are NOT allowed
  64.     gxOutRef.xltype = gxInRef.xltype = xltypeRef;
  65.     gxOutRef.val.mref.lpmref = (LPXLMREF)&gxlmOutRef;
  66.     gxInRef.val.mref.lpmref = (LPXLMREF)&gxlmInRef;
  67.     gxlmOutRef.count = gxlmInRef.count = 1;
  68.     
  69.     // init shared memory pools
  70.     gReturnPool = MemPoolInit(TRUE);
  71.     gScratchPool = MemPoolInit(TRUE);
  72.  
  73. #ifdef _USE_SMARTHEAP
  74. //    #ifdef DEBUG
  75.     MemSetSafetyLevel(MEM_SAFETY_DEBUG,TRUE);
  76. //    #endif
  77. #endif
  78.  
  79.     ghLibInst = hInstance;
  80.  
  81.     // Init function strings
  82.     // Each of the following strings are inited to PASCAL 
  83.     // type strings with a leading byte count 
  84.     InitPascalStrings(&rgFuncs[0][0], rgFuncsRows, 7);
  85.  
  86.     //    Init menu strings;
  87.     InitPascalStrings(&rgMenu[0][0], rgMenuRows, 5);
  88.  
  89.     //    Init dialog strings
  90.     InitPascalStrings(&rgDlgDiag[0][0], rgDlgDiagRows, 7);
  91.     InitPascalStrings(&rgDlgPoly[0][0], rgPolyDlgRows, 7);
  92.     InitPascalStrings(&rgDlgSpline[0][0], rgSplineDlgRows, 7);
  93.     InitPascalStrings(&rgDlgSgSmooth[0][0], rgSgSmoothDlgRows, 7);
  94.     InitPascalStrings(&rgDlgWtSmooth[0][0], rgWtSmoothDlgRows, 7);
  95.     InitPascalStrings(&rgDlgMO[0][0], rgDlgMORows, 7);
  96.     InitPascalStrings(&rgDlgCalcSpline[0][0], rgCalcSplineDlgRows, 7);
  97.     InitPascalStrings(&rgDlgAbout[0][0], rgDlgAboutRows, 7);
  98.     InitPascalStrings(&rgDlgCustomFit[0][0], rgCustomFitDlgRows, 7);
  99.         
  100.     // Init Framework library
  101.     InitFramework();
  102.     return (1);
  103. }
  104. #if 0
  105. /*********************************************************************
  106.  WEP()
  107.  =====
  108.  This function is the standard windows DLL exit routine
  109.  ********************************************************************/
  110. int PASCAL FAR _export WEP(int bSystemExit)
  111. {
  112.     return 1;
  113. }
  114. #endif
  115.